var payBtn = {
  goPay(e) {
    var that = this;
    // var courseItem = e.currentTarget.dataset.courseItem;
    /////////////
    // var coverMain = e.currentTarget.dataset.cover;
    // var name = e.currentTarget.dataset.name;
    // var currentPrice = e.currentTarget.dataset.price;
    // var updateDate = e.currentTarget.dataset.update;
    // var chapterCount = e.currentTarget.dataset.chapterCount || 0;//总共集数
    // var mediaType = e.currentTarget.dataset.mediaType;//类型
    // var id = e.currentTarget.dataset.sourceId;//资源id
    //////////
    var coverMain = that.data.course.coverMain;
    var name = that.data.course.name;
    var currentPrice = that.data.course.currentPrice;
    var updateDate = that.data.updateDate;
    var chapterCount = that.data.chapterCount || 0;//总共集数
    var mediaType = that.data.course.mediaType;//类型
    var id = that.data.course.id;//资源id
    var courseItem = {
      coverMain,
      name,
      currentPrice,
      updateDate,
      chapterCount,
      mediaType,
      id
    }
    courseItem = JSON.stringify(courseItem);
    wx.navigateTo({
      url: '../pay/pay?courseItem=' + courseItem,
    })
  },
  // 赠送
  goGiving(e) {
    var that = this;
    // var courseItem = e.currentTarget.dataset.courseItem;
    /////////////
    // var coverMain = e.currentTarget.dataset.cover;
    // var name = e.currentTarget.dataset.name;
    // var currentPrice = e.currentTarget.dataset.price;
    // var updateDate = e.currentTarget.dataset.update;
    // var chapterCount = e.currentTarget.dataset.chapterCount || 0;//总共集数
    // var mediaType = e.currentTarget.dataset.mediaType;//类型
    // var id = e.currentTarget.dataset.sourceId;//资源id
    //////////
    var coverMain = that.data.course.coverMain;
    var name = that.data.course.name;
    var currentPrice = that.data.course.currentPrice;
    var updateDate = that.data.updateDate;
    var chapterCount = that.data.chapterCount || 0;//总共集数
    var mediaType = that.data.course.mediaType;//类型
    var id = that.data.course.id;//资源id
    var courseItem = {
      coverMain,
      name,
      currentPrice,
      updateDate,
      chapterCount,
      mediaType,
      id
    }
    courseItem = JSON.stringify(courseItem);
    wx.navigateTo({
      url: '../pay/pay?courseItem=' + courseItem+'&payType=GIFT',
    })
  }, 
};

module.exports = payBtn;
